UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e+8PFQOPTj93Imi4wFa56VtN3ctqEMPGhdNOmfMDLJE=' 
WHERE 
  key_id = 'bd38c332c22e7663f7761b1607220e21a2d181dda9ce30139458a9d59db6ae0b' 
  AND (
    token = 'e+8PFQOPTj93Imi4wFa56VtN3ctqEMPGhdNOmfMDLJE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053