UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WM+MqhjjmCnI3PHUdkhcZO7AhZpt/mtBRlKzaw2I+K0=' 
WHERE 
  key_id = '7d3d3796cf39d55b2306d43954da2354af1c3126ffbc9153864e974a193e5204' 
  AND (
    token = 'WM+MqhjjmCnI3PHUdkhcZO7AhZpt/mtBRlKzaw2I+K0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037