UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XzEphm3MCnLdw6dn77io5BVLoA18P234SyiPq1MBXSY=' 
WHERE 
  key_id = 'e179e7911738b0c49459ce5ca81fb4b11ba559f831ba206d8e883000da473426' 
  AND (
    token = 'XzEphm3MCnLdw6dn77io5BVLoA18P234SyiPq1MBXSY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029