UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o7DnxEGE4Cro1UxeRgSBRVa4jfTSpQ9UAkzWM3tZ23g=' 
WHERE 
  key_id = '6fbcba67c7dcfa84c3cf8f91913698a1bcb35604fb31b75d5794c0992ee25ee1' 
  AND (
    token = 'o7DnxEGE4Cro1UxeRgSBRVa4jfTSpQ9UAkzWM3tZ23g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065