UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+S6oYUkkBUA65PuAbRX52qgUOyrKxp+YTXwTmhwx8Zs=' 
WHERE 
  key_id = 'dd6053c5852f4aba1f30a2143e0dec76a7d72d0f87e7fe333b59d58c7e663f4d' 
  AND (
    token = '+S6oYUkkBUA65PuAbRX52qgUOyrKxp+YTXwTmhwx8Zs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031