UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M5ptrcfleN/gbd5W2NHGb8/Is7E0Hic7aS8krlTR8Zk=' 
WHERE 
  key_id = 'db9600da97cb545a729f2847e90183bc5ed9281d1765d4bc4e0819f5a8e6ad3c' 
  AND (
    token = 'M5ptrcfleN/gbd5W2NHGb8/Is7E0Hic7aS8krlTR8Zk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024