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

Query time 0.00036