UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aWegeimT59+ZrS0RR76M/e8GjiO4SpnJgLoXmFiFuVw=' 
WHERE 
  key_id = 'e355c848c9465134691fa0fac246476a7154811e543b5845e178be151f95a1f4' 
  AND (
    token = 'aWegeimT59+ZrS0RR76M/e8GjiO4SpnJgLoXmFiFuVw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020