UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm4LWBYgy5fXimEj3yXajnVWkDI8wg2Dbvv0opgHfMjE=' 
WHERE 
  key_id = '8104cfd0563dc849f31ca6d4dbd0fb3294ac741d6bee4955f7cc5041e538c64a' 
  AND (
    token = 'm4LWBYgy5fXimEj3yXajnVWkDI8wg2Dbvv0opgHfMjE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048