UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b18g20UDrijOPH9Yy/y7HuD/rhEFU1C1CxfI7wPS1Uc=' 
WHERE 
  key_id = 'd635f4372cb4ece0c9ce2a6c066817ccd16ab70bd378eb8a4e830beb35169531' 
  AND (
    token = 'b18g20UDrijOPH9Yy/y7HuD/rhEFU1C1CxfI7wPS1Uc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053