UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RweqwDD/gmd970silX3XVIGUQDQJeEv7lipOvfjWlRM=' 
WHERE 
  key_id = 'b541ea369bf77f5d62067fada2a91eb0deb2f87ffa11eeb2f12c4c14b5a16067' 
  AND (
    token = 'RweqwDD/gmd970silX3XVIGUQDQJeEv7lipOvfjWlRM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031