UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9P9+vlTmVLfQeGDlymM+X4GNMIfoFQgj97KTn1tuY94=' 
WHERE 
  key_id = 'fc06d0ecc21951daf77e5e7cabf3a79284e6327bbfd96a8f9af03f5f9778c27c' 
  AND (
    token = '9P9+vlTmVLfQeGDlymM+X4GNMIfoFQgj97KTn1tuY94=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023