UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's8ZBxzuxab0KyUqV1/rCCb0sTNuzI8I/8u3Lyl/cXco=' 
WHERE 
  key_id = 'f09ea156324326fdabb85f520bb1f739958f13de869960659125b84d55e84597' 
  AND (
    token = 's8ZBxzuxab0KyUqV1/rCCb0sTNuzI8I/8u3Lyl/cXco=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037