UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RSS7Jc+69miNy5WsgtrtjECX1SRUvo9A8qCEKhMjxic=' 
WHERE 
  key_id = '6e0194c0bcb3636b0cf953946b7e0d68f6e4672a5f89128bf70c19b2e1af239f' 
  AND (
    token = 'RSS7Jc+69miNy5WsgtrtjECX1SRUvo9A8qCEKhMjxic=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065