UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MOZVjZg6BrfP8aImAalevr1N5wlyj1LL6mC09RUj4+8=' 
WHERE 
  key_id = '24e110b2fbd6b38c58717f3250083f7febbacf8391c108b8380ddad5e0b2efbb' 
  AND (
    token = 'MOZVjZg6BrfP8aImAalevr1N5wlyj1LL6mC09RUj4+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036