UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QX1CAdo33mwXyfRcyM82BCtpJemEocJgjhlpqfHTiwM=' 
WHERE 
  key_id = '4671af6354504c9adc25c1acf090573ce891d92036dbd21a728d953c4135ef96' 
  AND (
    token = 'QX1CAdo33mwXyfRcyM82BCtpJemEocJgjhlpqfHTiwM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032