UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wrNFpF0F4OW1vUJABfy+jFz4dr2VJVU1+u8h89klJZk=' 
WHERE 
  key_id = 'c672b62ebe1ecb4eefc349c2443557a628a42eac6c16cbcbffa476f61d26b642' 
  AND (
    token = 'wrNFpF0F4OW1vUJABfy+jFz4dr2VJVU1+u8h89klJZk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026