UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LFZdD1RNd9rl+8WLc0Eb+xl364Fuc9ZgNfijUSnI9yI=' 
WHERE 
  key_id = '536adf6a6888a991a96d149b66636193b16f6f032f086a9ca5d096e4743e6ba3' 
  AND (
    token = 'LFZdD1RNd9rl+8WLc0Eb+xl364Fuc9ZgNfijUSnI9yI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042