UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JQQTGON5zIq8RYKxuzXLzvyTsn3PU1VW1zIVKuWGAR0=' 
WHERE 
  key_id = '64af1105499da4b45e96930a21146a658f70670783891394720badd9b7a53b55' 
  AND (
    token = 'JQQTGON5zIq8RYKxuzXLzvyTsn3PU1VW1zIVKuWGAR0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037