UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c5y40Lg2GEuJwSGln8qcEV9igRZoBjRKTElfzjkcs6Q=' 
WHERE 
  key_id = '0f7d25cc9461a570684297209961e42b9264b250cfba97e4e7c3e84f3e8cbafe' 
  AND (
    token = 'c5y40Lg2GEuJwSGln8qcEV9igRZoBjRKTElfzjkcs6Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031