UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FDv9YY9JriMI+R6zyxGkoPwLtgIV+S6v9/rfEHJ03xM=' 
WHERE 
  key_id = 'a9ced818152b4378fac05c8b6b06bb545ad026d319194ec490117c8cb35a746b' 
  AND (
    token = 'FDv9YY9JriMI+R6zyxGkoPwLtgIV+S6v9/rfEHJ03xM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032