UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xQRq7fhWgEKHSkvFUXQzH4ZMV5qsdcHQJqInhrIlDp0=' 
WHERE 
  key_id = '07a9d5633930c6ce59a4cccdc4c7241083a49a41bcd29e0355d1a6b1bbfe548f' 
  AND (
    token = 'xQRq7fhWgEKHSkvFUXQzH4ZMV5qsdcHQJqInhrIlDp0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055