UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vItUzb2mFqNwdOq0HnuoTOhSKlU1xXWSADgL6zqz384=' 
WHERE 
  key_id = '5aff66c2070a773463fbc286186736122ddc8e7142774cbb9f2df17886561a45' 
  AND (
    token = 'vItUzb2mFqNwdOq0HnuoTOhSKlU1xXWSADgL6zqz384=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060