UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f2hTLVQ6aGwtNiW/lllssL3wM1GdUeA4qH4sFHDoJr4=' 
WHERE 
  key_id = '71fb6be48f5d250a8e03b2c3402ab9e19b77c76584665d8bea1b4262666af981' 
  AND (
    token = 'f2hTLVQ6aGwtNiW/lllssL3wM1GdUeA4qH4sFHDoJr4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035