UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pfOkFUmIu65Ylimp63gjSPk+Dpn4UQGEnDI+clUfKq0=' 
WHERE 
  key_id = '22a8634eb129d1d08d43c7eb95c92a923443a1abc23a0d47fbfc4c158b179a81' 
  AND (
    token = 'pfOkFUmIu65Ylimp63gjSPk+Dpn4UQGEnDI+clUfKq0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038