UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9AubsQm0NVqByEc620F3ia+MiPo5jotYErvvyFAUV/Y=' 
WHERE 
  key_id = 'bf24bcbf422461f57027c8249b3ec446b7740bdde4e3da46c848cdf3328c0097' 
  AND (
    token = '9AubsQm0NVqByEc620F3ia+MiPo5jotYErvvyFAUV/Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027