UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dw4VBLVYcQENWHP6HZytUCnuaSQY8mbEXaA4mlRYld8=' 
WHERE 
  key_id = 'ba9f4f13f17d1c2b70313cbe84dfca2e0d8ed70c616dcada837a185933101d51' 
  AND (
    token = 'Dw4VBLVYcQENWHP6HZytUCnuaSQY8mbEXaA4mlRYld8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026