UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J2oa39mOFs44nx5RdM3dUyEmHVpBbBQhBrF7Ej5uTQM=' 
WHERE 
  key_id = '0def902f6627ee1285934cc1f03f8ddea57b584cff37578cdec7902dee18f1d1' 
  AND (
    token = 'J2oa39mOFs44nx5RdM3dUyEmHVpBbBQhBrF7Ej5uTQM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018