UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7QVxxkxn5NKz32iytzKO5xUbzQLVPC8pywNuWtL6pWc=' 
WHERE 
  key_id = 'ec66e6c42369b488a823cc0b936bdc5e3faa7b5e9cc941cd23552bdee6d47490' 
  AND (
    token = '7QVxxkxn5NKz32iytzKO5xUbzQLVPC8pywNuWtL6pWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00166