UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'daTVjibK/+K92TEkijrwx8I8ccst4ygnl+skd9CbEvo=' 
WHERE 
  key_id = '808c4b2a26f7b3caae66af6d7bc1c42f117a0b2a79744e5799f5e8d9299a7057' 
  AND (
    token = 'daTVjibK/+K92TEkijrwx8I8ccst4ygnl+skd9CbEvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058