UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OGAFiwle97mdTMGS89XyrBv/bVzfzP1sDchww/gZMV4=' 
WHERE 
  key_id = 'ec0226f196a179ad4238acb6b947d86a597545fc8c3a49e3d8bea9ce5c450126' 
  AND (
    token = 'OGAFiwle97mdTMGS89XyrBv/bVzfzP1sDchww/gZMV4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050